<style>
.layui-input-block{
margin-left:120px;
}
</style>
<form class="layui-form" action="" id="orderEditForm">
  <div class="layui-form-item" style="padding-top:20px">
    <label class="layui-form-label col-sm-1" style="width:100px;">公司名称</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    	<input type="text" readOnly='true' class="layui-input" th:value="${entity.companyName}" required name="companyName" lay-verify="required"/>
    </div>
  </div> 
  <div class="layui-form-item" >
    <label class="layui-form-label col-sm-1" style="width:100px;"><font color='red' size="4">*</font>物料编码</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    	<input type="text" class="layui-input" th:value="${entity.materialCoding}" required name="materialCoding" lay-verify="required"/>
    </div>
    <label class="layui-form-label col-sm-1" style="width:100px;"><font color='red' size="4">*</font>物料名称</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
	    <input type="text" class="layui-input" th:value="${entity.materialName}" required name="materialName" lay-verify="required"/>
    </div>
    <label class="layui-form-label col-sm-1" style="width:100px;">物料规格</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    <input type="text" class="layui-input" th:value="${entity.materialSpec}" required name="materialSpec" lay-verify="required"/>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label col-sm-1" style="width:100px;"><font color='red' size="4">*</font>物料类型</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    	<select name="materialTypeId" lay-verify="required" lay-filter="materialTypeId" required >
	       <option th:each="s:${materialTypeList}" th:attr="value=${s.id}" th:text="${s.value}"
	       th:selected="${entity.materialTypeId}==${s.id}"
	       ></option>
	    </select>
    </div>
  	<label class="layui-form-label col-sm-1" style="width:100px;">品牌</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    	<select name="brandId" lay-verify="required" lay-filter="brandId" required >
	       <option th:each="s:${materialBrandList}" th:attr="value=${s.id}" th:text="${s.value}"
	       th:selected="${entity.brandId}==${s.id}"
	       ></option>
	    </select>
    </div>
  	<label class="layui-form-label col-sm-1" style="width:100px;"><font color='red' size="4">*</font>计价方式</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    	<select name="materialPriceTypeId" lay-verify="required" lay-filter="materialPriceTypeId" required >
	       <option th:each="s:${priceTypeList}" th:attr="value=${s.id}" th:text="${s.value}"
	       	 th:selected="${entity.materialPriceTypeId}==${s.id}"
	       ></option>
	    </select>
    </div>
  </div>
  <div class="layui-form-item">
  	<label class="layui-form-label col-sm-1" style="width:100px;"><font color='red' size="4">*</font>计量单位</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    	<select name="measurementUId" lay-verify="required" lay-filter="measurementUId" required >
	       <option th:each="s:${unitList}" th:attr="value=${s.id}" th:text="${s.name}" 
	       th:selected="${entity.measurementUId}==${s.id}"></option>
	    </select>
    </div>
    <label class="layui-form-label col-sm-1" style="width:100px;">最小包装量</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    	 <input type="text" class="layui-input" th:value="${entity.minimumPackingQuantity}"  required name="minimumPackingQuantity"  />
    </div>
  	<label class="layui-form-label col-sm-1" style="width:100px;"><font color='red' size="4">*</font>是否停用</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
      <input type="radio" name="isNoUsed" value="true"  title="是"  th:checked="${entity.isNoUsed} ==true">
      <input type="radio" name="isNoUsed" value="false" title="否"  th:checked="${entity.isNoUsed} ==false">
    </div>
  </div>
  
  <div class="layui-form-item">
  <label class="layui-form-label col-sm-1" style="width:100px;">是否委外</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    	<input type="radio" name="isOutsource" value="true" title="是" th:checked="${entity.isOutsource} ==true">
        <input type="radio" name="isOutsource" value="false" title="否" th:checked="${entity.isOutsource} ==false">
    </div>
  	<label class="layui-form-label col-sm-1" style="width:100px;">是否可销售</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    	<input type="radio" name="isSale" value="true" title="是" th:checked="${entity.isSale} ==true">
        <input type="radio" name="isSale" value="false" title="否" th:checked="${entity.isSale} ==false">
    </div>
  	<label class="layui-form-label col-sm-1" style="width:100px;">是否为外购</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    	<input type="radio" name="isBuy" value="true" title="是" th:checked="${entity.isBuy} ==true">
        <input type="radio" name="isBuy" value="false" title="否" th:checked="${entity.isBuy} ==false">
    </div>
  </div>
  <div class="layui-form-item">
  	<label class="layui-form-label col-sm-1" style="width:100px;">是否生产用</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    	<input type="radio" name="isProdConsumption" value="true" title="是" th:checked="${entity.isProdConsumption} ==true">
        <input type="radio" name="isProdConsumption" value="false" title="否" th:checked="${entity.isProdConsumption} ==false">
    </div>
  	<label class="layui-form-label col-sm-1" style="width:100px;">是否虚拟件</label>
    <div class="layui-input-block col-sm-2" style="width:250px;padding-left:0px;margin-left:0px;">
    	<input type="radio" name="isVirtual" value="true" title="是" th:checked="${entity.isVirtual} ==true">
        <input type="radio" name="isVirtual" value="false" title="否" th:checked="${entity.isVirtual} ==false">
    </div>
  </div>
  
  <div class="layui-form-item">
    <label class="layui-form-label col-sm-1 " style="width:100px;" >备注</label>
    <div class="layui-input-block col-sm-2" style="width:90%;padding-left:0px;margin-left:0px;">
      <input type="text" class="layui-input" th:value="${entity.remark}" required name="remark" lay-verify="required"/>
    </div>
    <!-- 隐藏域传递ID -->
    <input type="hidden" class="layui-input"  name="id"  th:value="${entity.id}"/>
  </div>
  
   <div class="layui-form-item">
    <div class="layui-input-block" >
          <button class="layui-btn" lay-submit="" lay-filter="formSubmit" authcode='900230'>提交</button>
      	  <button type="button" class="layui-btn layui-btn-primary" id="closeBtn">关闭</button>
    </div>
  </div>

</form>
<script>
layui.use('form', function(){
	  var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
	  form.render();
	  //监听提交
	  form.on('submit(formSubmit)', function(data){
	    $.ajax({
            type: "GET",
            url: "/eng/material/info/editMaterial",
            data: $("#orderEditForm").serializeJson(),
            dataType: "json",
            success: function(data){
            	if(data.code==200){
            	toastr.success(data.msg);
            	ins.reload({url:'/eng/material/info/page'})
            	//关闭弹出层
           	    layer.closeAll(editdialogindex);
           	    //更新表格数据
            	}else{
            		layer.msg(data.message);
            		//关闭
            	    layer.closeAll();
            	}
            }
           });
	  });
	  //关闭按钮
	  $("#closeBtn").click(function(){
		  layer.closeAll();
	  })
	});      
</script>
